<%  
# this partial renders a tabnav, you can call it in your views with:
#   <%= tabnav :patient % > (just the tabnav) 
# or, if you want a boxed tabnav:
#   <% tabnav :patient do % >
#     your html here
#   <% end % >
# (remove the space between % and >, we don't want to mess up your brand new tabnav :-))
#
# you can pass render_tabnav a few options:
#   :generate_css => true|false #=> generates a default inline css for the tabnav, defaults to false
#   :html => aHash #=> sets html options for the tabnav's div (es :html => {:class=> 'myCssClass', :id=>'myCssId'}) 
#     
render_tabnav :patient, 
							:generate_css => false do
    
  # this generates a tab for every controller in your app
  # you'll probably want to delete this and
  # add tabs one by one as shown below
  #controller_names.each do |name|
  #  add_tab do |t|
  #    t.named name.camelize
  #    t.titled "Go to #{name.camelize}"
  #    t.links_to :controller => name
  #  end
  # end 

	#<%= link_to 'Summary', patient_path(@patient.wedgetail) % >|
	#<%= link_to "Letters",patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>8) % > |
	#<%= link_to "Discharges",patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>3) % > |
	#<%= link_to "Medications",patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>2) % > |
	#<%= link_to "Results",results_patient_path(:id=>@patient.wedgetail) % > |
	#<%= link_to "Team",team_patient_path(:id=>@patient.wedgetail) % > |
	#<%= link_to "Goals",patient_goals_path(@patient.wedgetail) % >

  add_tab do |t|
    t.named 'Dashboard'
    t.links_to hash_for_patient_path(:id=>@patient.wedgetail)
  end

  add_tab do |t|
    t.named 'Wall'
		t.links_to hash_for_wall_patient_path(:id=>@patient.wedgetail)
  end
	if Narrative.count(:all,:conditions=>["wedgetail='#{@patient.wedgetail}' and narrative_type_id='1'"]) >0
  	add_tab do |t|
    	t.named 'Summary'
    	t.links_to hash_for_patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>1)
  	end
	end
	
	if Narrative.count(:all,:conditions=>["wedgetail='#{@patient.wedgetail}' and narrative_type_id='7'"]) >0
  	add_tab do |t|
    	t.named 'Results'
    	#t.links_to hash_for_results_patient_path(:id=>@patient.wedgetail)
			t.links_to hash_for_patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>7)
  	end
	end
	if Narrative.count(:all,:conditions=>["wedgetail='#{@patient.wedgetail}' and narrative_type_id='2'"]) >0
  	add_tab do |t|
    	t.named 'Meds'
    	t.links_to hash_for_patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>2)
  	end
	end
	care_plan=1 if @patient.conditions.count>0
	if care_plan
  	add_tab do |t|
    	t.named 'Goals'
    	t.links_to hash_for_patient_goals_path(:patient_id=>@patient.wedgetail)
  	end
  end
	if care_plan
  	add_tab do |t|
    	t.named 'Conditions'
			t.highlights_on :controller => "conditions"
    	t.links_to hash_for_patient_conditions_path(:patient_id=>@patient.wedgetail)
  	end
  end
	if care_plan
  	add_tab do |t|
    	t.named 'Team'
    	t.links_to hash_for_team_patient_path(:id=>@patient.wedgetail)
  	end
  end

  add_tab do |t|
    t.named 'Actions'
    t.links_to hash_for_patient_tasks_path(:patient_id=>@patient.wedgetail)
  end

	if care_plan
  	add_tab do |t|
    	t.named 'Care Plan'
    	t.links_to hash_for_careplan_patient_path(:id=>@patient.wedgetail)
  	end
  end

	if Narrative.count(:all,:conditions=>["wedgetail='#{@patient.wedgetail}' and narrative_type_id='15'"]) >0
  	add_tab do |t|
    	t.named 'ACD'
    	t.links_to hash_for_patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>15)
  	end
  end

	if Narrative.count(:all,:conditions=>["wedgetail='#{@patient.wedgetail}' and narrative_type_id='19'"]) >0
  	add_tab do |t|
    	t.named 'CMA'
    	t.links_to hash_for_patient_narratives_path(:patient_id=>@patient.wedgetail,:type=>19)
  	end
  end 
	add_tab do |t|
  	t.named 'New'
  	t.links_to :controller=>"entry",:action=>"new",:id=>@patient.wedgetail
	end

  #
  #add_tab do |t|
  #  t.named 'Home'
  #  t.titled 'Home Page'
  #  t.links_to :controller => 'welcome'
  #end 
  #  
  # you can use restful routes with:
  #
  #add_tab do |t|
  #  t.named 'Users'
  #  t.links_to hash_for_users_path
  #end
  #
  #add_tab do |t|
  #  t.named 'Customers'
  #  t.links_to :controller => 'customers'
  #end
  #  
  # # A tab can be initialized with a Hash like this:
  # 
  # add_tab :name => 'welcome', :link => {:controller=>'welcome'}
  #
  # # You can have a dynamic name or link 
  # # (this partial is evaluated in the page context, so it sees every helper or instance variable)
  #  
  # add_tab do |t|
  #   t.named "#{current_user} details"
  #   t.links_to :controller => 'users', :action => 'show', :id => current_user.id
  # end
  #  #

  # # You can have an image inside 
  # add_tab do |t|
  #   t.named image_tag('test')
  #   t.links_to :controller => 'users', :action => 'show', :id => current_user.id
  # end
end 
%>